import api from '../network/apis/api';
export default {
  namespaced: true,
  state: {
    pageData: {
      pageSize: 3, // 每页显示条数
      currentPage: 1, // 当前页
      totalPages: 1, // 总页数
      total: 0, // 总条数
      data: [],
    },
  },
  mutations: {
    setPageData(state, val) {
      state.pageData = val;
    },
  },
  actions: {
    //获得保险产品
    async getAllUsers(context) {
      const { data } = await api.users.getAllUsers({
        currentPage: context.state.pageData.currentPage,
        pageSize: context.state.pageData.pageSize,
      });
      console.log(data);
      if (data.status) {
        context.commit('setPageData', data.data);
      }
    },
  },
};
